package cinema;

import java.io.Serializable;

/**
 * 
 * 
 * @author Matt Couzens & Amanda Kosinski
 * @version 29 April 2012
 */

public class Booking implements Serializable {
	private Showing showing;
	private Person person;
	private int seats;
	private static int bookingRef;
	
	/**
	 * Constructs a booking
	 * 
	 * @param show The Showing being booked
	 * @param person The Person the booking is for
	 * @param seats The number of seats being booked
	 */
	public Booking(Showing show, Person person, int seats) {
		this.showing = show;
		this.person = person;
		this.seats = seats;
		show.setBookedSeats(show.getBookedSeats() + seats);
	}

	/**
	 * @return the showing
	 */
	Showing getShowing() {
		return showing;
	}

	/**
	 * @param showing the showing to set
	 */
	void setShowing(Showing showing) {
		this.showing = showing;
	}

	/**
	 * @return the person
	 */
	Person getPerson() {
		return person;
	}

	/**
	 * @param person the person to set
	 */
	void setPerson(Person person) {
		this.person = person;
	}

	/**
	 * @return the seats
	 */
	int getSeats() {
		return seats;
	}

	/**
	 * @param seats the seats to set
	 */
	void setSeats(int seats) {
		this.seats = seats;
	}
	
	/**
	*@Override
	**/
	public String toString(){
		return showing.toString() 
				+ ", Customer username: " + person.getUsername() 
				+ ", Number of seats booked: " 
				+ getSeats();
	}
}